from celery import Celery
from django.core.mail import send_mail
import time,os

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'p6shixun.settings')


app=Celery("mytask",broker="redis://127.0.0.1:6379/0",backend="redis://127.0.0.1:6379/1")


@app.task
def test():
    print("请来测试我吧")


@app.task
def add(x,y):
    return x+y


@app.task
def sendMail(email,uid):
    time.sleep(5)
    send_mail(subject="淘淘宝用户激活", message='',
              from_email="liubin_a@126.com",
              recipient_list=['2167048297@qq.com',email],
              html_message="恭喜你，亚麻跌,请点击超链接"
                           "<a href='http://127.0.0.1:8000/active?uid={}'>激活</a>".format(uid))

